3.6.27 \(\int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx\) [527]

Optimal. Leaf size=47 \[ \frac {b^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 a b \cos (c+d x)}{d}+\frac {\left (a^2-b^2\right ) \sin (c+d x)}{d} \]

[Out]

b^2*arctanh(sin(d*x+c))/d-2*a*b*cos(d*x+c)/d+(a^2-b^2)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.053, Rules used = {3588} \begin {gather*} \frac {\left (a^2-b^2\right ) \sin (c+d x)}{d}-\frac {2 a b \cos (c+d x)}{d}+\frac {b^2 \tanh ^{-1}(\sin (c+d x))}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a + b*Tan[c + d*x])^2,x]

[Out]

(b^2*ArcTanh[Sin[c + d*x]])/d - (2*a*b*Cos[c + d*x])/d + ((a^2 - b^2)*Sin[c + d*x])/d

Rule 3588

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^2/sec[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[b^2*(ArcTanh[Sin[e + f
*x]]/f), x] + (-Simp[2*a*b*(Cos[e + f*x]/f), x] + Simp[(a^2 - b^2)*(Sin[e + f*x]/f), x]) /; FreeQ[{a, b, e, f}
, x] && NeQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac {b^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 a b \cos (c+d x)}{d}+\frac {\left (a^2-b^2\right ) \sin (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.16, size = 84, normalized size = 1.79 \begin {gather*} \frac {-2 a b \cos (c+d x)+b^2 \left (-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+\left (a^2-b^2\right ) \sin (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a + b*Tan[c + d*x])^2,x]

[Out]

(-2*a*b*Cos[c + d*x] + b^2*(-Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2
]]) + (a^2 - b^2)*Sin[c + d*x])/d

________________________________________________________________________________________

Maple [A]
time = 0.20, size = 53, normalized size = 1.13

method result size
derivativedivides \(\frac {b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )-2 \cos \left (d x +c \right ) a b +a^{2} \sin \left (d x +c \right )}{d}\) \(53\)
default \(\frac {b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )-2 \cos \left (d x +c \right ) a b +a^{2} \sin \left (d x +c \right )}{d}\) \(53\)
risch \(-\frac {{\mathrm e}^{i \left (d x +c \right )} a b}{d}-\frac {i a^{2} {\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} b^{2}}{2 d}-\frac {{\mathrm e}^{-i \left (d x +c \right )} a b}{d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a^{2}}{2 d}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} b^{2}}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2}}{d}\) \(147\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(b^2*(-sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))-2*cos(d*x+c)*a*b+a^2*sin(d*x+c))

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 60, normalized size = 1.28 \begin {gather*} \frac {b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} - 4 \, a b \cos \left (d x + c\right ) + 2 \, a^{2} \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/2*(b^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c)) - 4*a*b*cos(d*x + c) + 2*a^2*sin(d*x
 + c))/d

________________________________________________________________________________________

Fricas [A]
time = 0.38, size = 62, normalized size = 1.32 \begin {gather*} -\frac {4 \, a b \cos \left (d x + c\right ) - b^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) + b^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/2*(4*a*b*cos(d*x + c) - b^2*log(sin(d*x + c) + 1) + b^2*log(-sin(d*x + c) + 1) - 2*(a^2 - b^2)*sin(d*x + c)
)/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (c + d x \right )}\right )^{2} \cos {\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))**2,x)

[Out]

Integral((a + b*tan(c + d*x))**2*cos(c + d*x), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 1316 vs. \(2 (47) = 94\).
time = 0.81, size = 1316, normalized size = 28.00 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/2*(b^2*log(2*(tan(1/2*d*x)^4*tan(1/2*c)^2 + 2*tan(1/2*d*x)^4*tan(1/2*c) + 2*tan(1/2*d*x)^3*tan(1/2*c)^2 + t
an(1/2*d*x)^4 + 2*tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^3 + 2*tan(1/2*d*x)*tan(1/2*c)^2 + 2*tan(1/2*d*x
)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2*tan(1/2*c)^2 - b^2*
log(2*(tan(1/2*d*x)^4*tan(1/2*c)^2 - 2*tan(1/2*d*x)^4*tan(1/2*c) - 2*tan(1/2*d*x)^3*tan(1/2*c)^2 + tan(1/2*d*x
)^4 + 2*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^3 - 2*tan(1/2*d*x)*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2 + tan(
1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2*tan(1/2*c)^2 + 4*a*b*tan(1/2*
d*x)^2*tan(1/2*c)^2 + b^2*log(2*(tan(1/2*d*x)^4*tan(1/2*c)^2 + 2*tan(1/2*d*x)^4*tan(1/2*c) + 2*tan(1/2*d*x)^3*
tan(1/2*c)^2 + tan(1/2*d*x)^4 + 2*tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^3 + 2*tan(1/2*d*x)*tan(1/2*c)^2
 + 2*tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c)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x)^2 - 16*a*b*tan(1/2*d*x)*tan(1
/2*c) - 4*a*b*tan(1/2*c)^2 + b^2*log(2*(tan(1/2*d*x)^4*tan(1/2*c)^2 + 2*tan(1/2*d*x)^4*tan(1/2*c) + 2*tan(1/2*
d*x)^3*tan(1/2*c)^2 + tan(1/2*d*x)^4 + 2*tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^3 + 2*tan(1/2*d*x)*tan(1
/2*c)^2 + 2*tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*c)^2 + 1)) - b^2*log(2
*(tan(1/2*d*x)^4*tan(1/2*c)^2 - 2*tan(1/2*d*x)^4*tan(1/2*c) - 2*tan(1/2*d*x)^3*tan(1/2*c)^2 + tan(1/2*d*x)^4 +
 2*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^3 - 2*tan(1/2*d*x)*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2 + tan(1/2*c
)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*c)^2 + 1)) - 4*a^2*tan(1/2*d*x) + 4*b^2*tan(1/2*d*x) - 4*a^2
*tan(1/2*c) + 4*b^2*tan(1/2*c) + 4*a*b)/(d*tan(1/2*d*x)^2*tan(1/2*c)^2 + d*tan(1/2*d*x)^2 + d*tan(1/2*c)^2 + d
)

________________________________________________________________________________________

Mupad [B]
time = 3.89, size = 66, normalized size = 1.40 \begin {gather*} \frac {2\,b^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {4\,a\,b-\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a^2-2\,b^2\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)*(a + b*tan(c + d*x))^2,x)

[Out]

(2*b^2*atanh(tan(c/2 + (d*x)/2)))/d - (4*a*b - tan(c/2 + (d*x)/2)*(2*a^2 - 2*b^2))/(d*(tan(c/2 + (d*x)/2)^2 +
1))

________________________________________________________________________________________